package com.springboot.cloud.demos.ribbon.rest;

import com.springboot.cloud.common.core.entity.vo.Result;
import com.springboot.cloud.common.core.oss.OssUtil;
import com.springboot.cloud.demos.ribbon.service.WeixinApiService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.codec.digest.DigestUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@Api(tags = "微信开放接口")
@RestController
@RequestMapping(value = "/weixin")
public class WeixinApiController {
    @Resource
    private WeixinApiService weixinApiService;

    @ApiOperation(value = "获取小程序码")
    @PostMapping("/getwxacodeunlimit")
    public Result getwxacodeunlimit(@RequestBody String body) {
        String fileKey = DigestUtils.md5Hex(body);
        return Result.success(weixinApiService.getwxacodeunlimit(fileKey, body));
    }
}
